<?php

namespace App\Http\Controllers\Stats\Platform;

use Helper\Timed;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Resources\Common\DatasResource;
use App\Services\Stats\Platform\SettlementService;

class SettlementController extends Controller
{
	public function __construct()
	{
		Timed::setForceNotAbs();
	}
    /**
     * 获取数据列表【全部】
     */
    public function all(Request $request)
    {
        list ($collection, $total, $stats) = SettlementService::create()->all($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }

    /**
     * 获取数据列表【游戏】
     */
    public function game(Request $request)
    {
        list ($collection, $total, $stats) = SettlementService::create()->game($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }

    /**
     * 获取数据列表【游戏场景】
     */
    public function gameScene(Request $request)
    {
        list ($collection, $total, $stats) = SettlementService::create()->gameScene($request);

        return DatasResource::make($collection)->setPaginateTotal($total)->setAttribute('stats', $stats);
    }

    /**
     * 获取平台统计USD
     */
    public function getUsd(Request $request)
    {
        list ($collection, $stats) = SettlementService::create()->getUsd($request);

        return DatasResource::make($collection)->setAttribute('stats', $stats);
    }
}
